<%@ page language="java" import="java.util.*" pageEncoding="utf-8"%>
<%@taglib prefix="s"  uri="/struts-tags"%>

<script type="text/javascript" src="<%=request.getContextPath()%>/ext/jquery_jcrop/jquery.Jcrop.min.js"></script>
<link rel="stylesheet" href="<%=request.getContextPath()%>/ext/jquery_jcrop/jquery.Jcrop.min.css">

<title>文件浏览</title>

<form id="ulform" action="upload!fileSave" enctype="multipart/form-data" method="post">
<table class="table_box table_all_border" cellspacing="0" cellpadding="0">
	<input type="hidden" name="cfile.id" value="${cfile.id}" />
	<input type="hidden" name="cfile.path" value="${cfile.path}" />
	<input type="hidden" name="cfile.type" value="${cfile.type}" />
	<tr>
	<td align="right"> 客户id </td>
	<td colspan="3">RF02<input type="text" class="companyid"  readonly="readonly" name="cfile.cid"  id="companyid"  value="${sessionScope.companyid}" /></td>
	</tr>
	<tr>
	 <td>材料名称</td>
     <td class="wfive"><input type="text" class="wet" name="cfile.name" value="${cfile.name }" ></td>
     <!-- 
     <td align="center"><input type="file" name="${testname }" id="file" value="选择图片" /></td>
     <!-- 
    <input type="submit" value="修改 " />
     -->
    </tr>
</table>
</form>

<form id="form" action="upload!filelist" method="post">
	<input type="submit" value="返回" />
</form>


    
    <a href="${cfile.path }" target="_blank">点击查看文件</a>
 
<!--  
原图：
<img src="${picUrl}" id="target" />

<form action="uploadPic!cutPic" method="post">
	点击
	<input type="text" name="x" id="x"/>
	<input type="text" name="y" id="y"/>
	<input type="text" name="width" id="width"/>
	<input type="text" name="height" id="height"/>
	<input type="submit" value="确定" />
	，设置完成。
</form>
-->

<script type="text/javascript">
	jQuery(function($){
    var jcrop_api,
        boundx,
        boundy,
        
        $pcnt = $("#preview"),
        $pimg = $("#preview img"),
        xsize = $pcnt.width(),
        ysize = $pcnt.height();
    $("#target").Jcrop({
      onChange: updatePreview,
      onSelect: updatePreview,
      aspectRatio: 1
    },function(){
      var bounds = this.getBounds();
      boundx = bounds[0];
      boundy = bounds[1];
      jcrop_api = this;
    });

    function updatePreview(c) {
      if (parseInt(c.w) > 0){
        var rx = xsize / c.w;
        var ry = ysize / c.h;
        $pimg.css({
          width: Math.round(rx * boundx) + 'px',
          height: Math.round(ry * boundy) + 'px',
          marginLeft: '-' + Math.round(rx * c.x) + 'px',
          marginTop: '-' + Math.round(ry * c.y) + 'px'
        });
        $('#width').val(c.w);  //c.w 裁剪区域的宽  
        $('#height').val(c.h); //c.h 裁剪区域的高  
        $('#x').val(c.x);  //c.x 裁剪区域左上角顶点相对于图片左上角顶点的x坐标  
        $('#y').val(c.y);  //c.y 裁剪区域顶点的y坐标</spa
      }
    };

  });


</script>
